package roleView 
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	/**
	 * 
	 * @author Kylin206
	 */
	public class SkinPool 
	{
		
		//=================静态管理===============
		
		static private var _skinLib:ISkinLib = null;
		
		static public function _getRoleSkin(type:uint, equip:uint, color:uint, act:String):RoleSkin
		{
			var c:Class = _skinLib.getSkinClass(type, act);
			
			var skin:RoleSkin = new c();
			skin.isWeaponUp = checkInclude(equip, 1);
			skin.isArmourUp = checkInclude(equip, 2);
			skin.isHatUp = checkInclude(equip, 4);
			
			skin.color = color;
			return skin;
		}
		
		/**
		 * 特效和子弹
		 * @param	id
		 * @param	target
		 * @param	scale
		 * @return
		 */
		static public function getEffect(id:String, target:DisplayObject, scale:Number = 1):EffSprite
		{
			/*var frames:Vector.<BitmapFrameInfo> = getBitmapFrameInfo(id);
			if(!frames)
			{
				frames = cacheTarget(target, scale);
				FrameBmpPool.storeBitmapFrameInfo(id, frames);
			}*/
			
			return new EffSprite(id,target);
		}
		
		/**
		 * totalI 的位中是否包含 i;
		 * @param	totalI
		 * @param	i
		 * @return
		 */
		static private function checkInclude(totalI:uint,i:uint):Boolean
		{
			return i == (totalI & i);
		}
		
		static public function set skinLib(value:ISkinLib):void 
		{
			_skinLib = value;
		}
		
		/**
		 * 获取位图帧信息序列
		 * @param	id
		 * @return
		 */
		static public function getBitmapFrameInfo(id:String):Vector.<BitmapFrameInfo>
		{
			return FrameBmpPool.getBitmapFrameInfo(id);
		}
		
		
		static public function clear():void
		{
			FrameBmpPool.clear();
		}
		
		
	}

}
import flash.display.DisplayObject;
import roleView.BmpSprite;

class EffSprite extends BmpSprite
{
	private var src:DisplayObject
	public function EffSprite(id:String, src:DisplayObject)
	{
		this.id = id;
		this.src = src;
		draw();
	}
	
	override protected function getSrc():DisplayObject
	{
		return src;
	}
	
}